home *** CD-ROM | disk | FTP | other *** search
- Captain Learjet #1 @8755
- Wed Sep 26 02:38:41 1990
-
- /*
-
-
-
- Test Upload Mod
- ~~~~~~~~~~~~~~~
- v1.3
-
-
- by
-
- Captain Learjet
- 1 @8755
-
- Sysop of
- - = InFlight = -
-
- 817-766-0533
-
-
- Hi! There have been several complaints about the Test Arc, Viruscan,
- Comment Upload and a few other mods having a severe bug that would open
- a bunch of files, and not close them causing the BBS to freak out and
- not find any file anywhere.
-
- Well it turns out that this was happening because of those mods using
- the dliscan() function improperly. Files were being opened twice and closed
- only once resulting in the above problem after a few uploads, depending on
- what the Sysop has his FILES= set at.
-
- The following is new and improved version of three mods combined.
- The Test Arc mod originally written by The Captain, the Viruscan mod
- written by The Caretaker and the Comment Upload mod. I can't remember who
- wrote the Comment mod (SORRY! :) ).
-
- This function will run an archive test and/or scan for viruses on files
- uploaded with the .ARC, .LZH, .PAK, .ZIP .EXE and .COM extensions. It will
- also add an ANSI comment to your .ZIP files. In addition, you can run any
- one of the three sections individually.
-
- Also, ^C (heart) means ^P^C in most editors.
-
-
- Disclaimer (of course)
-
- If it screws up, it's not my fault. I didn't force you to use it.
- It runs flawlessly on my system.
-
- I ask for a donation of 0 dollars, and 0 cents, cuz it sucks to
- ask for money.
-
- How's that? */
-
- << Step one: >>
-
- Load BBS.C and do this in void dlmainmenu() :
-
-
-
- if (strcmp(s,"/O")==0)
- hangup=1;
- if ((strcmp(s,"/?")==0) && (dcs())) /* <-- Search for this. */
- printmenu(8);
- if (strcmp(s,"/T")==0) /* ADD */
- test_arc(); /* ADD */
- if (strcmp(s,"/V")==0) /* ADD */
- check_for_virus(); /* ADD */
- if ((strcmp(s,"/K")==0) && (dcs())) /* ADD */
- add_comment(); /* ADD */
- if ((strcmp(s,"UPLOADALL")==0) && (dcs())) { /* original code */
-
-
- Save BBS.C
-
-
- << Step two: >>
-
-
- Load XFER.C and add the following FOUR functions near the top
- of the file:
-
-
- void test_upload(int l, int sysop, char *s)
- {
- char s1[81],s2[81],s3[81];
- int i,i1,type,abort,next;
- uploadsrec u;
-
- type=abort=next=0;
-
- if (l) {
- align(s);
- dliscan();
- }
- i=recno(s);
- do {
- if (i>0) {
- SETREC(i);
- read(dlf,(void *)&u,sizeof(uploadsrec));
- if (l==0 || l==1) {
- if ((compare(u.filename,"????????.ARC")) ||
- (compare(u.filename,"????????.LZH")) ||
- (compare(u.filename,"????????.PAK")) ||
- (compare(u.filename,"????????.ZIP"))) {
- if (!sysop)
- sprintf(s1,"%s%s",directories[udir[curdir].subnum].path,
- stripfn(u.filename));
- else
- sprintf(s1,"%s%s",directories[0].path,stripfn(u.filename));
- if (exist(s1)) {
- ansic(2);
- print("Testing archive integrity of ",u.filename,":","");
- nl();
- if (strstr(u.filename,".ARC"))
- sprintf(s2,"PKUNPAK -T %s",s1);
- if (strstr(u.filename,".LZH"))
- sprintf(s2,"LHARC T %s",s1);
- if (strstr(u.filename,".PAK"))
- sprintf(s2,"PAK T %s",s1);
- if (strstr(u.filename,".ZIP"))
- sprintf(s2,"PKUNZIP -T %s",s1);
- i1=run_external1(s2);
- prt(2,u.filename);
- if (i1) {
- pl(" 6 \7FAILED\7 2 the archive test!");
- nl();
- sprintf(s2,"2%s 6FAILED 2 an archive test. Please check the file!0",u.filename);
- ssm(1,0,s2);
- sysoplog(s2);
- if (l)
- closedl();
- return;
- } else {
- prt(5,"5 PASSED 2 the archive test.");nl();
- }
- }
- checka(&abort,&next);
- }
- }
- if (l==0 || l==2) {
- if ((compare(u.filename,"????????.ARC")) ||
- (compare(u.filename,"????????.LZH")) ||
- (compare(u.filename,"????????.PAK")) ||
- (compare(u.filename,"????????.ZIP")))
- type=1;
- if ((compare(u.filename,"????????.EXE")) ||
- (compare(u.filename,"????????.COM")))
- type=2;
- if (type) {
- if (!sysop)
- sprintf(s1,"%s%s",directories[udir[curdir].subnum].path,
- stripfn(u.filename));
- else
- sprintf(s1,"%s%s",directories[0].path,stripfn(u.filename));
- if (exist(s1)) {
- nl();
- ansic(2);
- print("Scanning ",u.filename," for viruses:","");
- nl();
- prt(3,"Please be patient...");nl();
- if (type==1) {
- if (strstr(u.filename,".ARC"))
- sprintf(s2,"PKUNPAK %s %s",s1,syscfg.tempdir);
- if (strstr(u.filename,".LZH"))
- sprintf(s2,"LHARC X %s %s",s1,syscfg.tempdir);
- if (strstr(u.filename,".PAK"))
- sprintf(s2,"PAK E %s %s",s1,syscfg.tempdir);
- if (strstr(u.filename,".ZIP"))
- sprintf(s2,"PKUNZIP %s %s",s1,syscfg.tempdir);
- run_external(s2);
- sprintf(s3,"SCAN /nomem %s*.*",syscfg.tempdir);
- i1=run_external1(s3);
- remove_from_temp("*.*",0);
- } else {
- sprintf(s2,"SCAN /nomem %s",s1),
- i1=run_external1(s2);
- }
- prt(2,u.filename);
- if (i1==1) {
- pl(" 6 \7FAILED\7 2 the virus test! 0");
- nl();
- sprintf(s2,"%s FAILED the virus test. Please delete the file!",
- u.filename);
- ssm(1,0,s2);
- sysoplog(s2);
- if (l)
- closedl();
- return;
- } else {
- pl(" 5PASSED 2 the virus test. 0");
- nl();
- }
- }
- checka(&abort,&next);
- }
- }
- if (l==0 || l==3) {
- if (compare(u.filename,"????????.ZIP")) {
- sprintf(s3,"Adding comment to %s",u.filename);
- prt(2,s3);nl();
- if (!sysop)
- sprintf(s1,"PKZIP -z %s%s < %sCOMMENT.TXT",
- directories[udir[curdir].subnum].path,stripfn(u.filename),
- syscfg.gfilesdir);
- else
- sprintf(s1,"PKZIP -z %s%s < %sCOMMENT.TXT",
- directories[0].path,stripfn(u.filename),syscfg.gfilesdir);
- run_external(s1);
- }
- checka(&abort,&next);
- }
- }
- i=nrecno(s,i);
- } while ((i>0) && (!hangup) && (!abort));
- if (l)
- closedl();
- }
-
- void test_arc()
- {
- char s[81];
-
- nl();
- prt(2,"Archive to Test: ");
- mpl(12);
- input(s,12);
- if (strchr(s,'.')==NULL)
- strcat(s,".*");
- test_upload(1,0,s);
- topscreen();
- }
-
- void check_for_virus()
- {
- char s[81];
-
- nl();
- prt(2,"Archive to Scan: ");
- mpl(12);
- input(s,12);
- if (strchr(s,'.')==NULL)
- strcat(s,".*");
- test_upload(2,0,s);
- topscreen();
- }
-
- void add_comment()
- {
- char s[81];
-
- nl();
- prt(2,"Add Comment to: ");
- mpl(12);
- input(s,12);
- if (strchr(s,'.')==NULL)
- strcat(s,".*");
- test_upload(3,0,s);
- topscreen();
- }
-
- << Step three: >>
-
- In the function void upload(int dn) add this stuff:
-
-
- sprintf(s,"+%s uploaded on %s",u.filename,directories[dn].name);
- sysoplog(s); /* search for the above line */
- if (!incom) { /* ADD */
- nl(); /* ADD */
- prt(5,"Test the File? "); /* ADD */
- if (yn()) /* ADD */
- test_upload(0,0,u.filename); /* ADD */
- } else { /* ADD */
- if (!dn) /* ADD */
- test_upload(0,1,u.filename); /* ADD */
- else /* ADD */
- test_upload(0,0,u.filename); /* ADD */
- } /* ADD */
- nl();
- pl("File uploaded."); /* Original code continues */
-
-
-
- Save XFER.C
-
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-
- Now recompile.
-
-
- Notes
-
- New with this release:
-
- Now works when the user uploads with the 'Z' command and also if the
- Sysop has all uploads going to the Sysop directory only.
-
-
- *********** READ THIS ***********
- \/
- If you are currently using Test Upload 1.2 or before, you must replace
- all the functions with the new ones.
-
- The new functions are more portable. You no longer have to hard code
- your temporary directory into the function. You must now have your
- COMMENT.TXT file in your GFILES directory.
-
-
- You must have PKUNPAK, LHarc, PAK, PKZIP and PKUNZIP in your WWIV
- directory. If you don't have all of these get them. Or if you don't
- allow uploads of all types of archives, edit this file accordingly.
-
-
- You also need to get a copy of McAfee's SCAN program, VERSION 62 or HIGHER
- and put it in your WWIV dir.
-
-
-
- If you use this at LEAST email 1 @ 8755 and tell me!
-
-
-
-
- COMING SOON! Test Upload 2.0 to be run as the WWIV 4.12 Upload Event.
-
-
-
-
- 7Captain Learjet
- 215@ 78755
- aka
- 3Donnie Sigrist